#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long LL;
const LL MOD=1000000007;
LL POW(LL b) {
    LL res=1;
    LL tmp=2;
    while (b) {
        if (b&1) {
            res=(res*tmp)%MOD;
        }
        tmp=(tmp*tmp)%MOD;
        b=b>>1;
    }
    return res;
}
int main() {
    LL n;
    LL res,tmp;
    while (cin>>n) {
        res=0;
        tmp=POW(n-4);
        for (int i=1; i<n; ++i) {
            for (int j=i+1; j<n; ++j) {
                res=(res+(POW(i-1)-1)*POW(n-2-i)%MOD+(POW(j-2)-1)*POW(n-1-j)%MOD)%MOD;
            }
        }
        cout<<res<<endl;
    }
    return 0;
}
